package com.singzi.leetcode.N100;

public class T0035 {
    public static void main(String[] args) {
        int []nums = {1, 5, 9, 6, 33, 85, 100};

        Solution0035 solution0035 = new Solution0035();
        System.out.println(solution0035.searchInsert(nums, 18));

    }
}

class Solution0035 {
    public int searchInsert(int[] nums, int target) {
        for(int i = 0;i<nums.length;i++){
            if(target == nums[i]) return i;
            else if(target<nums[i]) return i;
        }
        return nums.length;


    }
}
